package com.example.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.example.demo.pojo.Person;
import com.example.demo.service.PersonService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

@Controller
@RequestMapping("/sqlitetest")
public class SqliteController {
	@Autowired
	private PersonService personService = null;
	
	@RequestMapping("/index")
	public ModelAndView index() {
		ModelAndView mv = new ModelAndView();
		List<Person> persons = personService.queryAllPerson();
		mv.setViewName("index");
		mv.addObject("persons", persons);
		return mv;
	}
	
}
